package cn.nbs.user.dao;

import java.sql.SQLException;

import org.apache.commons.dbutils.handlers.BeanHandler;

import cn.com.hkr.jdbc.TxQueryRunner;
import cn.nbs.user.entity.User;

public class UserDao {
	private TxQueryRunner qr = new TxQueryRunner();
	
	/**
	 * 通过用户名和密码查询
	 * @param loginname
	 * @param loginpass
	 * @return
	 */
	public User findByLoginnameAndPassword(String loginname,String loginpass){
		String sql = "select  *  from t_user where loginname = ? and loginpass = ?";
		try {
			return qr.query(sql, new BeanHandler<User>(User.class),loginname,loginpass);
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
		
		
	}
}
